package com.probiz.estore.cart.service.impl;

import java.util.Comparator;
import java.util.Date;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;

import com.probiz.estore.Constants;
import com.probiz.estore.common.model.cart.ShoppingcartItem;
import com.probiz.estore.common.model.cart.ShoppingcartItemGc;
import com.probiz.estore.common.model.product.ProductSku;
import com.probiz.estore.common.model.product.WholesalePrice;
import com.probiz.estore.core.service.impl.GenericManagerImpl;
import com.probiz.estore.cart.service.ShoppingcartItemManager;


/**
 * Manager implementation for ShoppingcartItem, responsible for business processing, and communicate between web and persistence layer.
 */
public class ShoppingcartItemManagerImpl extends GenericManagerImpl<ShoppingcartItem> implements ShoppingcartItemManager {



	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.service.impl.GenericManagerImpl#init()
	 */
	@Override
	protected void initManager() {

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.service.impl.GenericManagerImpl#preDelete(java.lang.Object)
	 */
	@Override
	protected void preDelete(ShoppingcartItem entity) {

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.service.impl.GenericManagerImpl#preSave(java.lang.Object)
	 */
	@Override
	protected void preSave(ShoppingcartItem entity) {

	}

	public ShoppingcartItem updateQuantity(ShoppingcartItem item,
			Integer quantity) {
		return null;
	}
	
	public ShoppingcartItem newShoppingcartItem(ProductSku productsku, Integer quantity, short isSaved){
		
//		ShoppingcartItem item = new ShoppingcartItem();
//		item.setProductSku(productsku);
//		item.setAddTime(new Date());
//		item.setCreateTime(new Date());
//		item.setPrice(productsku.getPrice());
//		item.setIsSaved(isSaved);
//		item.setSkuType(productsku.getSkuKind());  
//		item.setQuantity(quantity);
//		item.setItemType(Constants.ITEM_TYPE_PRODUCT);
//		
//        this.isWholesaleOrSales(productsku, item, quantity);
//		
//		return item;
		return null;
	}
	

	public ShoppingcartItem newShoppingcartItem(ShoppingcartItemGc gc) {
//		ShoppingcartItem item = new ShoppingcartItem();
//		item.setShoppingcartItemGc(gc);
//		item.setAddTime(new Date());
//		item.setCreateTime(new Date());
//		item.setPrice(gc.getGiftCertAmt());
//		item.setSkuType((short)0);  
//		item.setQuantity(1);
//		item.setIsSaved(ShoppingcartItem.ISSAVED_NO);
//		item.setItemType(Constants.ITEM_TYPE_GC);
//		item.setIsOnSale(ShoppingcartItem.ISONSALE_NO);
//		item.setIsWholesale(ShoppingcartItem.ISWHOLESALE_NO);
//		gc.setShoppingcartItem(item);
//		return item;
		return null;
	}

	public ShoppingcartItem getShoppingcartItemByGcId(Integer gcId) {
//		if(gcId==null)return null;
//		ShoppingcartItem item = shoppingcartItemDao.getItemByGcId(gcId);
//		return item;
		return null;
	}
}
